package com.aaa.controller;

import com.aaa.service.T_CommentSettingsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Author: TT
 * @Date: 2019/3/19 15:43
 * @Version 1.0
 */
@Controller
@RequestMapping("/setting/")
public class T_CommentSettingsController {
    @Autowired
    private T_CommentSettingsService  service;
    @RequestMapping("go")
    public String go(){
        return  "T_CommentSettings/T_CommentSettings";
    }
    @RequestMapping("list")
    @ResponseBody
    public Map list(@RequestBody  Map map){

        Map map1=new HashMap();
        List<Map> list=service.list(map);
        Integer   total=service.count(map);
        List<Map> list1=service.person(map);
        List<Map> xlist=service.insertxid();
        map1.put("data",list);
        map1.put("total",total);
        map1.put("person",list1);
        map1.put("insertxid",xlist);
        return  map1;
    }
    @RequestMapping("insert")
    @ResponseBody
    public  Integer insert(@RequestBody Map map){
        String pstate=service.supdxid();
        map.put("pstate",pstate);
        Integer i=service.xids();
        System.out.println(map.get(pstate)+"1111111111111111111111111111111111");
        return service.insert(map);
    }
    @RequestMapping("upd/{id}")
    @ResponseBody
    public Integer upd( @PathVariable Integer id){
            return service.upd(id);
    }
    @RequestMapping("updxid/{id}")
    @ResponseBody
    public  Integer updxid(@PathVariable Integer id){
        return  service.updxid(id);
    }
    @RequestMapping("selectId")
    @ResponseBody
    public  Object selectId(@RequestBody Map map){
            return  service.selectId(map);
    }
    @RequestMapping("del/{id}")
    @ResponseBody
    public  Integer del(@PathVariable Integer id){
        return  service.del(id);
    }
    @RequestMapping("ups/{id}")
    @ResponseBody
    public Integer ups(@PathVariable Integer id){
        return  service.ups(id);
    }
    // 修改评议计划
    @RequestMapping("update")
    @ResponseBody()
    public  Integer update(@RequestBody Map map){
            return  service.update(map);
    }
}
